Memory system and method for controlling nonvolatile memory

ABSTRACT

According to one embodiment, a memory system includes a nonvolatile memory including a plurality of blocks and a controller. The controller manages a garbage collection count for each of blocks containing data written by a host, the garbage collection count indicating the number of times the data in said each of the blocks has been copied by a garbage collection operation of the nonvolatile memory. The controller selects, as garbage collection target blocks, first blocks associated with a same garbage collection count. The controller copies valid data in the first blocks to a copy destination free block. The controller sets, as a garbage collection count of the copy destination free block, a value obtained by adding one to a garbage collection count of the first blocks.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation application of, and claims thebenefit of priority under 35 U.S.C. § 120 from, U.S. application Ser.No. 15/912,150, filed Mar. 5, 2018, and U.S. application Ser. No.15/059,749, filed Mar. 3, 2016, now U.S. Pat. No. 9,946,643, issued Apr.17, 2018, which claims the benefit of priority under 35 U.S.C. § 119from Japanese Patent Application No. 2015-242997, filed Dec. 14, 2015.The entire contents of each of the above applications are incorporatedherein by reference.

FIELD

Embodiments described herein relate generally to technology ofcontrolling a nonvolatile memory.

BACKGROUND

Recently, memory systems comprising nonvolatile memories have becomewidespread.

As one of these memory systems, a NAND-flash solid-state drive (SSD) isknown.

Because of their low-power-consumption and high-performance, SSDs areused as the main storage of various computers.

By the way, in data written to the SSD by the host, characteristics(i.e., data locality) where part of the data is rewritten frequently,and the remaining part is not rewritten frequently may exist.

Such data locality may increase the write amplification of the SSD, andmay adversely affect the performance and life of the SSD as a result.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating a configuration example of amemory system according to an embodiment.

FIG. 2 is an illustration for describing a garbage collection countmanagement operation and a garbage collection operation, which areperformed by the memory system of the embodiment.

FIG. 3 is an illustration of a garbage collection (GC) count managementlist used in the memory system of the embodiment.

FIG. 4 is an illustration for describing a garbage collection (GC)target block select operation performed by the memory system of theembodiment based on the GC count management list.

FIG. 5 is an illustration for describing a garbage collection (GC)operation performed by the memory system of the embodiment.

FIG. 6 is an illustration for describing examples of types of datawritten to the memory system of the embodiment.

FIG. 7 is a graph illustrating a relationship example between a garbagecollection (GC) count and the ratio between the amounts of various typesof data.

FIG. 8 is a flowchart for a procedure of a garbage collection (GC)operation performed by the memory system of the embodiment.

FIG. 9 is an illustration for describing a garbage collection (GC)operation performed by the memory system of the embodiment, whichincludes processing of merging valid data in two block groups havingdifferent GC counts.

FIG. 10 is a flowchart of a procedure of the GC operation performed bythe memory system of the embodiment, which includes the processing ofmerging valid data in two block groups having different GC counts.

FIG. 11 is an illustration for describing an operation of permittingmerge processing only for block groups having GC counts greater than orequal to a particular count.

FIG. 12 is a flowchart of a procedure of the GC operation that includesan operation of permitting merge processing only for block groups havingGC counts greater than or equal to a particular count.

FIG. 13 is an illustration for describing an operation, performed by thememory system of the embodiment, of sequentially allocating free blocksfor writing data received from a host.

FIG. 14 is an illustration for an example of a block-use-ordermanagement list used by the memory system of the embodiment.

FIG. 15 is an illustration for describingaccumulated-written-data-amount calculation operation performed by thememory system of the embodiment when a write to the same LBA isrequested.

FIG. 16 is an illustration of a sequence ofaccumulated-written-data-amount response processing performed by thememory system of the embodiment.

FIG. 17 is a flowchart of a procedure of theaccumulated-written-data-amount response processing performed by thememory system of the embodiment.

FIG. 18 is an illustration of another sequence of theaccumulated-written-data-amount response processing performed by thememory system of the embodiment.

FIG. 19 is a flowchart of another procedure of theaccumulated-written-data-amount response processing performed by thememory system of the embodiment.

FIG. 20 is an illustration of an example of a lookup table used in thememory system of the embodiment.

FIG. 21 is a flowchart of a procedure of time-data response processingperformed by the memory system of the embodiment when a write to thesame LBA is requested.

FIG. 22 is a flowchart of a procedure of processing performed by thehost based on accumulated-written-data-amount/time data received fromthe memory system of the embodiment.

FIG. 23 is a block diagram illustrating a configuration example of thehost.

FIG. 24 is a perspective view illustrating a computer that includes thememory system of the embodiment and the host.

DETAILED DESCRIPTION

Embodiments will be described hereinafter with reference to theaccompanying drawings.

In general, according to one embodiment, a memory system includes anonvolatile memory including a plurality of blocks memory, and acontroller electrically connected to the nonvolatile memory.

The controller performs a garbage collection operation of thenonvolatile memory. The controller manages a garbage collection countfor each of blocks containing data written by a host. The garbagecollection count indicates the number of times the data in said each ofthe blocks has been copied by the garbage collection operation.

The controller selects, as garbage collection target blocks, a pluralityof first blocks associated with a same garbage collection count. Thecontroller copies valid data in the first blocks to a copy destinationfree block. The controller sets, as a garbage collection count of thecopy destination free block, a value obtained by adding one to a garbagecollection count of the first blocks.

Referring first to FIG. 1, a description will be given of an informationprocessing system 1 that includes a memory system according to theembodiment.

This memory system is a semiconductor storage device configured to writedata to a nonvolatile memory, and read data from a nonvolatile memory.The memory system is realized as, for example, a NAND-flash technologybased solid-state drive (SSD) 3.

The information processing system 1 includes a host (host device) 2, andthe SSD 3. The host 2 is an information processing apparatus such as aserver or a personal computer.

The SSD 3 may be used as the main storage of an information processingapparatus that functions as the host 2. The SSD 3 may be accommodated inthe information processing apparatus or connected thereto via a cable ora network.

As an interface for interconnecting the host 2 and the SSD 3, SCSI,Serial Attached SCSI (SAS), ATA, Serial ATA (SATA), PCI Express (PCIe),Ethernet (registered trademark), Fiber Channel, etc., may be used.

The SSD 3 comprises a controller 4, a nonvolatile memory (NAND memory)5, and a DRAM 6. The type of the NAND memory 5 is not limited. The NANDmemory 5 may include a plurality of NAND flash memory chips.

The NAND memory 5 includes a number of NAND blocks (physical blocks) B0to Bm-1. Each of physical blocks B0 to Bm-1 serves as an erase unit. Thephysical block may also be referred to as a “block” or “erase block”.

Physical blocks B0 to Bm-1 include many pages (physical pages). That is,each of physical blocks B0 to Bm-1 includes pages P0 to Pn-1. In theNAND memory 5, reading and writing of data are executed page by page.Erasure of data is executed block by block.

The controller 4 is electrically connected to the NAND memory 5 as anonvolatile memory via a NAND interface 13 such as a toggle or ONFI. Thecontroller 4 may function as a flash translation layer (FTL) configuredto execute data management in the NAND memory 5 and block management inthe NAND memory 5.

The data management includes, for example, (1) management of mappingdata indicating the relationship between logical block addresses (LBAs)and physical addresses, and (2) processing of hiding read/writeoperations page by page and erase operations block by block. Mappingbetween the LBAs and the physical addresses is managed using a look-uptable (LUT) 33. The look-up table (LUT) 33 functions alogical-to-physical address translation table. The look-up table (LUT)33 is used to manage mapping between the LBAs and the physical addressesby a predetermined management size. Most write commands from the host 2request writing data of 4 Kbytes. Accordingly, the look-up table (LUT)33 may manage the mapping between the LBAs and the physical addresses inunits of 4 Kbytes. A physical address corresponding to a certain LBAindicates a physical storage location within the NAND memory 5 to whichthe data of this LBA is written. The physical address includes aphysical block address and a physical page address. Respective physicalpage addresses are allocated to all pages and respective physical blockaddresses are allocated to all physical blocks.

Writing of data to a page is enabled only once per erase cycle.

Accordingly, the controller 4 maps write (overwrite) to a certain LBA toanother page in the NAND memory 5. That is, the controller 4 writes thedata to this another page. Further, the controller 4 updates the look-uptable (LUT) 33 and associates this LBA with this another page, and alsoinvalidates the original page (the old data with which this LBA has beenassociated).

The block management includes a bad block management, wear leveling,garbage collection, etc. The wear leveling is an operation of levelingthe program/erase cycles (i.e., erase counts) among the physical blocks.

The garbage collection is an operation of creating a free space in theNAND memory 5. The garbage collection operation copies, to another block(a copy-target free block), all valid data items in several targetblocks in which valid data and invalid data are mixed, in order toincrease the number of free blocks in the NAND memory 5. Further, thegarbage collection operation updates the look-up table (LUT) 33, andmaps the respective LBAs of the copied valid data to correct physicaladdresses. A block, which includes only the invalid data after the validdata has been copied to another block, becomes a free block. Thus, thisblock can be reused after erasure.

The host 2 sends a write command to the SSD 3. The write commandincludes the logical address (starting logical address) of write data(namely, the data to be written), and a transfer length. Although inthis embodiment, the LBA is used as the logical address, an object IDmay be used as the logical address in another embodiment. The LBA isrepresented by a serial number allocated to a logical sector (logicalblock). The serial number starts with zero. The size of the logicalsector is, for example, 512 bytes.

The controller 4 of the SSD 3 writes, to a physical page of a physicalblock in the NAND memory 5, write data specified by the starting logicaladdress (starting LBA) and the transfer length in the write command.Further, the controller 4 updates the look-up table (LUT) 33 to map theLBA corresponding to the written data to a physical addresscorresponding to a physical storage location at which this data iswritten.

More specifically, the controller 4 allocates one of the free blocks inthe NAND memory 5 for writing data from the host 2. This allocated blockis a write target block to which the data from the host is to bewritten, and will also be referred to as a “write destination block” or“input block”. While updating the LUT 33, the controller 4 sequentiallywrites data received from the host 2 to available pages in the writetarget block (write destination block). If there is no more availablepage in the write target block, the controller 4 sets a new free blockas the write target block.

Next, the configuration of the controller 4 will be described.

The controller 4 includes a host interface 11, a CPU 12, the NANDinterface 13, a DRAM interface 14, an SRAM 15, etc. The CPU 12, the NANDinterface 13, the DRAM interface 14 and the SRAM 15 are interconnectedvia a bus 10.

The host interface 11 receives, from the host 2, various commands (awrite command, a read command, an UNMAP command, etc.).

The write command requests the SSD 3 to write data specified by thiswrite command. The write command includes the LBA (starting LBA) of afirst logical block to be written, and a transfer length (the number oflogical blocks). The read command requests the SSD 3 to read dataspecified by this read command. The read command includes the LBA of afirst logical block to be read, and a transfer length (the number oflogical blocks).

The CPU 12 is a processor configured to control the host interface 11,the NAND interface 13, the DRAM interface 14 and the SRAM 15. The CPU 12executes, for example, command processing for processing variouscommands from the host 2, in addition to the above-mentioned FTLprocessing.

Upon receiving, for example, a write command from the host 2, thecontroller 4 performs a write operation, described below, of writing, tothe NAND memory 5, write data specified by the write command.

Specifically, the controller 4 writes write data to the physical storageposition (available page) of a current write target block, and updatesthe LUT 33 to thereby map the physical address of this physical storageposition to an LBA (starting LBA) included in the write command.

The FTL processing and command processing may be controlled by firmwareexecuted by the CPU 12. The firmware causes the CPU 12 to function as agarbage collection (GC) count management unit 21, a garbage collection(GC) operation control unit 22 and an update-frequency data respondingunit 23.

The data written by the host 2 to the SSD 3 may have characteristics(i.e., data locality) that part of the data is rewritten frequently, andthe remaining part is not rewritten frequently. In this case, if agarbage collection (GC) operation has been repeatedly performed using anormal GC algorithm of selecting, as GC target blocks, some blockscontaining larger amounts of invalid data, data of high updatefrequencies and data of low update frequencies may well be mixed in asingle block. The mixture of data of high update frequencies and data oflow update frequencies in a block may increase the write amplificationof the SSD 3.

This is because, in the block in which data of a high update frequency(hot data) and data of a low update frequency (cold data) are merged,only some areas in the block are invalidated earlier by the update ofthe hot data, while the other areas in the block (storing the cold data)are maintained in a valid state for a long time.

If a block is filled with only the hot data, it is very likely that alldata in this block will be invalidated relatively early by the update(rewrite) of the data. Accordingly, this block can be reused by simplyerasing the block without executing the garbage collection.

In contrast, if the block is filled with only the cold data, all data inthe block is kept in the valid state for a long time. Accordingly, it isvery probable this block will not become a target of the garbagecollection for a long time.

The write amplification (WA) is defined as follows:WA=(Total amount of data written to SSD)/(Total amount of data writtento SSD from host)

The total amount of data written to the SSD, above, corresponds to thesum of the total amount of data written to the SSD from the host and thetotal amount of data written to the SSD internally by, for example, thegarbage collection.

An increase in the write amplification (WA) leads to an increase in thenumber of rewrites (the number of program/erase cycles) of each of theblocks in the SSD 3. That is, the greater the write amplification (WA)is, the faster the number of program/erase cycles of the block reachesits upper limit. This causes degradation in the endurance and life ofthe SSD 3.

In order to enable discrimination between data of high updatefrequencies and data of low update frequencies, the embodiment employs aGC function considering the GC count of data in a block, and a functionof notifying an LBA-base update frequency.

The GC count management unit 21 and the GC operation control unit 22execute the GC function considering the GC count of data in a block, andthe function of notifying an LBA-base update frequency, respectively.The GC function considering the GC count of data in a block executes animproved GC operation capable of controlling an increase in the writeamplification of the SSD 3 because of data locality.

The GC count management unit 21 manages the GC count of each blockcontaining data written by the host 2. The GC count of a certain blockindicates the number of times the data in the block has been copied byGC operations. That is, the GC count of the certain block indicates howmany times the data of the block has been copied as valid data.

Regarding a block immediately after data has been written thereto by thehost 2, namely, a block which does not contain data collected (copied)by the GC operation, its GC count is set to 0.

Some blocks wherein the GC count is 0 are selected as GC target blocks(copy source blocks). After the valid data of these blocks are copied toa copy destination free block, the GC count management unit 21 sets theGC count of this copy destination free block to 1. This is because thedata of the copy destination free block is data once copied as validdata from the GC target block (copy source block).

Each block (copy source block), which includes only the invalid data asthe valid data has been copied to a copy destination free block, becomesa free block. Since a free block contains no data, it is not necessaryto manage the GC count of the free block.

If some blocks (copy source blocks) wherein the GC count is 1 have beenselected as GC target blocks, and the valid data of these blocks havebeen copied to a copy destination free block, the GC count managementunit 21 sets the GC count of this copy destination free block to 2. Thisis because the data of the copy destination free block is data alreadytwice copied as valid data.

As described above, the GC count associated with a certain blockindicates how many times the data of the block was copied by past GCoperations, i.e., indicates how many GC operations were performed on thedata of the block.

The GC operation control unit 22 performs an improved GC operation inwhich some blocks associated with the same GC count are selected astarget blocks of a GC operation, and only the valid data of these blocksassociated with the same GC count is copied to the same copy destinationblock.

For instance, the GC operation control unit 22 selects some blocks as GCtarget blocks from a group of blocks associated with the same GC count(namely, a set of block having the same GC count). The GC operationcontrol unit 22 copies, to a copy destination free block, the valid dataof the blocks selected as the GC target blocks. After that, the GC countmanagement unit 21 sets the GC count of this copy destination free blockto a value obtained by adding 1 to the GC count of the blocks selectedas the GC target blocks.

The function of notifying an LBA-base update frequency is a function ofnotifying the host 2 of the frequency of writes to an LBA included in awrite command, thereby efficiently assisting the host 2 to separate hotand cold data.

The function of notifying an LBA-base update frequency is executed bythe update-frequency data responding unit 23.

Upon receiving a write command including an LBA from the host 2, theupdate-frequency data responding unit 23 notifies the host 2, inresponse to the write command, of a value associated with the time thathas elapsed from the last write to this LBA to the current write to thisLBA, or of a written data amount accumulated from the last write to thecurrent write. The written data amount may a total amount of datawritten to the NAND memory 5 by the host 2 during a time ranging from alast write to this LBA to a current write to this LBA. Thus, the actualupdate frequency (rewrite frequency) of user data can be notified to thehost 2. As a result, the host 2 can classify various types of datahaving different update frequencies into, for example, data (hot data)of higher update frequencies, data (cold data) of lower updatefrequencies, and data (warm data) of intermediate frequencies. Thisenables the host 2 to execute processing of, for example, distributingdifferent types of data to different SSDs, when necessary.

Other components of the controller 4 will now be described.

The NAND interface 13 is a NAND controller configured to control theNAND memory 5 under control of the CPU 12.

The DRAM interface 14 is a DRAM controller configured to control theDRAM 6 under control of the CPU 12.

A part of the storage area of the DRAM 6 may be used as a write buffer(WB) 31 for temporarily storing data to be written to the NAND memory 5.The storage area of the DRAM 6 may also be used as a GC buffer 32 fortemporarily storing data to be moved during a GC operation. The storagearea of the DRAM 6 may further be used for storing the above-mentionedlook-up table 33.

The storage area of the DRAM 6 may further be used as s GC countmanagement list 34 and a block-use-order management list 35.

The GC count management list 34 is a list for holding GC countscorresponding to respective blocks which contain data written by thehost 2. The GC count management list 34 may be a table showing thecorrespondence relationship between block IDs (for example, physicalblock addresses) of these blocks and the GC counts of the data of theseblocks.

Alternatively, the GC count management list 34 may comprise a pluralityof GC count lists for managing blocks corresponding to respective GCcounts (for example, a GC count of 0 to a GC count of n). The GC countof n is the upper limit of GC counts to be managed. For example, a GCcount list with the GC count of 0 holds a list of block IDs (forexample, physical block addresses) of blocks associated with the GCcount of 0. A GC count list with the GC count of 1 holds a list of blockIDs (for example, physical block addresses) of blocks associated withthe GC count of 1.

The block-use-order management list 35 holds allocation numbers(sequential numbers) allocated to blocks allocated as write targetblocks. That is, the controller 4 allocates, to the blocks allocated aswrite target blocks, numbers (allocation numbers) that indicate theorder of allocation. The numbers may be sequential numbers that startwith 1. For example, an allocation number of 1 is allocated to a blockfirst allocated as a write target block, an allocation number of 2 isallocated to a block second allocated as a write target block, and anallocation number of 3 is allocated to a block third allocated as awrite target block. This enables management of a block use history thatshows the order in which the blocks are allocated as write targetblocks. As the allocation numbers, counter values, which are incrementedby one whenever a new free block is allocated as a write target block,can be used.

The SSD 3 may hold yet other types of management data. The yet othertypes of management data may include a page management table that holdsvalid/invalid flags corresponding to physical addresses. Eachvalid/invalid flag indicates whether a corresponding physical address(physical page) is valid. The valid physical page means that the datatherein is valid. The invalid physical page means that the data thereinis invalidated by its update (rewrite).

The configuration of the host 2 will be described.

The host 2 is an information processing apparatus configured to executevarious computer programs. The programs executed by the informationprocessing apparatus include an application software layer 41, anoperating system 42 and a file system 43.

As is generally known, the operating system 42 is software configured tomanage the entire host 2, control the hardware within the host 2, andexecute control for enabling applications to use the hardware and theSSD 3.

The file system 43 is used for controlling the operation (creation,saving, update, deletion, etc.) of files. For example, ZFS, Btrfs, XFS,ext4, NTFS, etc., may be used as the file system 43. Alternatively, afile object system (for example, Ceph Object Storage Daemon), or a keyvalue storage system (for example, Rocks DB) may be used as the filesystem 43.

Various application software threads run on the application softwarelayer 41. Examples of the application software threads are clientsoftware, database software, virtual machine, etc.

When the application software layer 41 needs to send a request, such asa read command or a write command, to the SSD 3, it sends the request tothe operating system 42. The operating system 42, in turn, sends thatrequest to the file system 43. The file system 43 translates the requestinto a command (a read command, a write command, etc.). The file system43 sends the command to the SSD 3. Upon receiving a response from theSSD 3, the file system 43 sends the response to the operating system 42.The operating system 42, in turn, sends the response to the applicationsoftware layer 41.

Referring then to FIGS. 2 to 12, the GC function considering the GCcount of data in a block will be described in detail.

FIG. 2 shows a GC count management operation and a GC operationperformed by the SSD 3.

The controller 4 of the SSD 3 allocates a certain free block as a block(write target block) for writing data (write data) from the host 2, andsequentially writes write data received from the host 2 to availablepages in the write target block. When all pages of the current writetarget block have been filled with data, the controller 4 manages thecurrent write target block as an active block (i.e., a block containingdata). Furthermore, the controller 4 allocates another free block as anew write target block. Thus, in the SSD 3, the data (write data)received from the host 2 is sequentially written to pages (from thefirst page toward the last page) of the current write target block inthe order of arrival.

Blocks B11 to B17 in FIG. 2 are blocks obtained immediately after datahas been written by the host 2, i.e., blocks wherein data therein isnever been copied by the GC operation. The GC count corresponding toeach of the blocks B11 to B17 is 0.

Over time, part of the data of each of the blocks B11 to B17 may beinvalidated by rewriting. In this case, in each of the blocks B11 toB17, valid data and invalid data may be mixed.

When the number of free blocks becomes less than a threshold, thecontroller 4 starts a GC operation of making a free block from someblocks that each contain valid data and invalid data.

The controller 4 first selects some blocks wherein valid data andinvalid data are mixed as GC target blocks. When selecting GC targetblocks, the controller 4 selects a group of blocks associated with thesame GC count, as mentioned above. The group of blocks may be a set ofblocks to which, for example, a block having a maximum amount of invaliddata belongs, i.e., a set of blocks that have the same GC count as theblock having the maximum amount of invalid data. In this case, thecontroller 4 may select a block having a maximum amount of invalid datafrom blocks that contains the data written by the host 2. Subsequently,the controller 4 may select, as GC operation target blocks, the blockhaving the maximum amount of invalid data, and one or more blocksassociated with the same GC count as that of the first-mentioned block.

The controller 4 copies, to a copy destination free block, valid data insome selected GC target blocks (some blocks associated with the same GCcount), and sets, as the GC count of the copy destination free block, avalue obtained by adding 1 to the GC count of the GC target blocks. As aresult, the value obtained by adding 1 to the GC count of the GC targetblocks is carried on into the copy destination free block. Thus, the GCcount of the copy destination free block can correctly indicate how manytimes the data in the copy destination free block was copied in the pastby the GC operation.

For example, if two blocks B11 and B12 associated with the same GC counthave been selected as GC target blocks, and valid data in the blocks B11and B12 has been copied to a copy destination free block B21, the GCcount of the copy destination free block B21 is set to a value (1 inthis case) that is obtained by adding 1 to the GC count (0 in this case)of the blocks B11 and B12.

Similarly, if three blocks B13, B14 and B15 associated with the same GCcount have been selected as GC target blocks, and valid data in theblocks B13, B14 and B15 has been copied to a copy destination free blockB22, the GC count of the copy destination free block B22 is set to avalue (1 in this case) that is obtained by adding 1 to the GC count (0in this case) of the blocks B13, B14 and B15.

Yet similarly, if two blocks B16 and B17 associated with the same GCcount have been selected as GC target blocks, and valid data in theblocks B16 and B17 has been copied to a copy destination free block B23,the GC count of the copy destination free block B23 is set to a value (1in this case) that is obtained by adding 1 to the GC count (0 in thiscase) of the blocks B16 and B17.

Over time, part of the data of each of the blocks B21, B22 and B23 maybe invalidated by rewriting. In this case, in each of the blocks B21,B22 and B23, valid data and invalid data may be mixed.

If two blocks B21 and B22 associated with the same GC count have beenselected as GC target blocks, and valid data in the blocks B21 and B22has been copied to a copy destination free block B31, the GC count ofthe copy destination free block B31 is set to a value (2 in this case)that is obtained by adding 1 to the GC count (1 in this case) of theblocks B21 and B22.

As described above, in the embodiment, the GC count managed block byblock indicates how many times data in each block has been copied bypast GC operations. In order to manage the GC count correctly, the valueobtained by adding 1 to the GC count of the GC target blocks is carriedon into the copy destination free block.

FIG. 3 shows an example of the GC count management list 34.

If a GC-count upper limit n to be managed is, for example, 10, the GCcount management list 34 may comprise eleven GC count listscorresponding to GC counts of 0 to 10.

A GC count list corresponding to a GC count of 0 indicates a list ofblock IDs (for example, physical block addresses) allocated to blocksassociated with the GC count of 0. A GC count list corresponding to a GCcount of 1 indicates a list of block IDs (for example, physical blockaddresses) allocated to blocks associated with the GC count of 1.Similarly, a GC count list corresponding to a GC count of 10 indicates alist of block IDs (for example, physical block addresses) allocated toblocks associated with the GC count of 10. Each GC count list may beassociated with only blocks in which valid and invalid data are mixed.

FIG. 4 shows a GC-target-block select operation performed by thecontroller 4.

In processing of selecting GC target blocks, the GC operation controlunit 22 of the controller 4 may first select a group of GC target blocksfrom a plurality of block groups (i.e., a plurality of GC count lists)associated with different GC counts. FIG. 4 shows a case where a groupof blocks (blocks B2, B5, B11 and B21) having a GC count of 5 areselected, and then some GC target blocks are selected from the group ofblocks having the GC count of 5.

For instance, in the processing of selecting GC target blocks, first, ablock that satisfies a predetermined condition may be selected as afirst GC candidate. The block that satisfies the predetermined conditionmay be a block included in active blocks (i.e., blocks containing datawritten by the host 2) and having a largest amount of invalid data. Inanother embodiment, the block that satisfies the predetermined conditionmay be the oldest block in the active blocks. In the description below,a case where a block having a largest amount of invalid data is selectedas the first GC candidate is assumed.

If the block having the largest amount of invalid data is block B5, thecontroller 4 determines a GC count list including block B5 (in thiscase, a GC count list associated with the GC count of 5), selects, asthe GC target blocks, the blocks (blocks B2, B5, B11 and B21) indicatedby the GC count list associated with the GC count of 5, and then selectssome GC target blocks from the blocks indicated by the list. Forexample, one or more blocks having larger amounts of invalid data may beselected as the GC target blocks from blocks B2, B5, B11 and B21. Inthis case, for example, the block B5 having a largest amount of invaliddata, and one or more other blocks having larger amounts of invalid data(blocks B2, B11, or B21) may be selected as the GC target blocks.

FIG. 5 shows a GC operation performed by the controller 4.

The controller 4 manages a free block pool (free block list) 60including all free blocks. The controller 4 selects one free block fromthese free blocks. The controller 4 sets the selected free block as acopy destination free block B1000. The controller 4 copies all validdata from the GC target blocks having the same GC count (in this case,blocks B2, B5 and B11) to the copy destination free block B1000. Afterthat, the controller 4 updates the look-up table 33, thereby mapping theLBAs of the valid data to respective physical addresses in the copydestination free block B1000.

The GC count of the copy destination free block B1000 is set to a valueobtained by adding 1 to the GC count (=5) of blocks B2, B5 and B11.Block B1000 is added to a GC count list with a GC count of 6. Blocks B2,B5 and B11 become free blocks that do not include valid data. Blocks B2,B5 and B11 converted into free blocks are discarded from the GC countlist with the GC count of 5.

FIG. 6 shows examples of two or more types of data written to the SSD 3.

In FIG. 6, a case where three types of data (data items A, B and C)having different update frequencies are written to the SSD 3 is assumed.The data storage area (LBA space) of the SSD 3 includes three spacescorresponding to LBA groups A, B and C.

Data item A written to LBA group A is of a low update frequency, and theamount of data item A is largest among data items A, B and C. That is,LBA group A has a largest LBA range.

Data item C written to LBA group C is of a high update frequency, andthe amount of data item C is smallest among data items A, B and C. Thatis, LBA group C has a smallest LBA range.

Data item B written to LBA group B is of an update frequencyintermediate between those of data items A and C, and the amount of dataitem B is intermediate between those of data items A and C.

The percentage of the amount of data item A to the total user capacityof the SSD 3 may be 50%, for example. The percentage of the amount ofdata item B to the total user capacity of the SSD 3 may be 30%, forexample. The percentage of the amount of data item C to the total usercapacity of the SSD 3 may be 20%, for example.

The update frequency of data item A, i.e., the frequency of writing toLBA group A, may be 20%, for example. The update frequency of the dataitem B, i.e., the frequency of writing to LBA group B, may be 30%, forexample. The update frequency of data item C, i.e., the frequency ofwriting to LBA group C, may be 50%, for example.

In this case, for example, after the SSD 3 is filled with data items A,B and C, one of two write commands, issued from the host 2 to the SSD 3,requests write (update) of data item C (LBA group C), and one of fivewrite commands, issued from the host 2 to the SSD 3, requests write(update) of data item A (LBA group A). That is, data item C is updatedwith a high percentage of 50%.

When the data written to the SSD 3 has data locality as shown in theupper portion of FIG. 6, data items A, B and C are merged in each writetarget block, as is shown in the lower portion of FIG. 6.

In one write target block, the percentage of the amount of data item Cto the block capacity is 50%, the percentage of the amount of data itemB to the block capacity is 30%, and the percentage of the amount of dataitem A to the block capacity is 20%.

Since as mentioned above, the amount of data item C is less than thoseof data items A and B, and the update frequency of data item C isgreater than those of data items A and B, it is strongly possible thatmost of data C in each block will be invalidated early. In contrast, itis strongly possible that data items A and B, in particular, data itemA, will be maintained in the valid state for a long time.

Blocks, where the amount of invalid data is increased by updating(rewriting) data item C, will soon become GC target blocks, and validdata is copied from these blocks to a copy destination free block. Ineach GC target block, it is strongly possible that a greater part ofdata item C is invalidated, and greater parts of data items A and B aremaintained as valid data. Accordingly, in the copy destination block,the amounts of data items A and B are greater than in the GC targetblock, and the amount of data item C is less than in the GC targetblock.

In the embodiment, since the valid data of some blocks of the same GCcount is copied to a copy destination free block, the valid data of ablock having a small GC count is prevented from being copied by a GCoperation to the same copy destination free block as the valid data of ablock having a large GC count. Therefore, the greater the GC count of ablock, the greater the ratio of the amount of data item A to thecapacity of the block. This enables data item A (cold data) to beisolated from data item C (hot data).

FIG. 7 shows a relationship example between the GC count and thepercentages of the amounts of data items A, B and C.

In each block with a GC count of 0, the percentage of the amount of dataitem C to the block capacity is 50%, the percentage of the amount ofdata item B to the block capacity is 30%, and the percentage of theamount of data item A to the block capacity is 20%.

The ratio of the amount of data item C to the block capacity is quicklyreduced by one, two or the like GC operations. As the GC count isincreased, the ratio of the amount of data item B to the block capacityis gradually reduced.

As described above, in the embodiment, the valid data of a block havinga small GC count is prevented from being copied to the same copydestination free block as the valid data of a block having a large GCcount. Therefore, the blocks containing data can be classified into (1)a group including substantially only data item A (in this case, the GCcount is, for example, 7 to 10), (2) a group including data items A andB and almost no data item C (in this case, the GC count is, for example,3 to 6), and (3) a group including all data items A, B and C (in thiscase, the GC count is, for example, 0 to 2).

In other words, in the embodiment, the percentages of the amounts ofdata items A, B and C can be made equal among blocks of the same GCcount.

Therefore, the improved GC operation of the embodiment, in which thevalid data of some blocks of the same GC count is copied to the samecopy destination free block, can classify data to be written to the SSD3 (even when the data has significant locality) into a group includingsubstantially only data item A, a group including data items A and B andalmost no data item C, and a group including all data items A, B and C,thereby gradually separating hot and cold data. As a result, increasesin the write amplification of the SSD 3 can be suppressed.

The flowchart of FIG. 8 shows the procedure of a GC operation performedby the controller 4.

The controller 4 checks the number of remaining free blocks (step S11),and determines whether the number of remaining free blocks is less thanor equal to threshold th1 (step S12). This check may be performedperiodically. For instance, the number of remaining free blocks may bechecked when a new free block is set as a write target block.

If the number of remaining free blocks is less than or equal tothreshold th1 (YES in step S12), the controller 4 selects a first GCcandidate from all active blocks. The first GC candidate may be a blockhaving a maximum amount of invalid data. In this case, the block havingthe maximum amount of invalid data is selected as the first GC candidatefrom all active blocks (step S13). The controller 4 refers to the GCcount management list 34, selects a group of blocks (a first group ofblocks) associated with the same GC count as that of the first GCcandidate (in this case, the block having the maximum invalid dataamount), and further selects some GC target blocks from the first groupof blocks (step S14). In step S14, a group of blocks (the first group ofblocks) indicated by a GC count list that includes the first GCcandidate (for example, the block having the maximum invalid dataamount) is selected, and some GC target blocks are selected from thefirst group of blocks. In this case, the first candidate (for example,the block having the maximum invalid data amount) and one or more otherblocks included in the GC count list may be selected as GC targetblocks.

The controller 4 copies all valid data of the selected GC target blocksto a copy destination free block (step S15). In step S15, valid data isread from each valid page of the selected GC target blocks, and iswritten to each available page of the copy destination free block. Instep S15, while updating the look-up table (LUT) 33 to associate the LBAof the copied valid data with the physical address of the copydestination free block, the controller 4 updates the page managementtable to invalidate the original pages (namely, old data associated withthis LBA) of the GC target blocks. At this time, the controller 4 mayfirst refer to the look-up table (LUT) 33 to thereby acquire thephysical addresses of original pages storing the copied valid data, andthen update the page management table to set, to a value indicatinginvalid, valid/invalid flags corresponding to the physical addresses.

After that, the controller 4 sets, as the GC count of the copydestination free block, a value obtained by adding one to the GC countof each of the selected GC target blocks, i.e., a value obtained byadding one to the GC count of the first block group (step S16).

FIG. 9 shows a GC operation including processing of merging the validdata of two block groups having different GC counts.

For example, if the amount of valid data included in a group of blocks(GC target block group) associated with the same GC count as that of ablock having a maximum amount of invalid data is less than a threshold,the controller 4 performs processing of merging the valid data of twoblock groups having different GC counts. In this case, the controller 4may select another block group having a GC count as close to the GCcount of the GC target block group as possible.

Assume, for instance, a case where the block having the maximum amountof invalid data is block B30, and the GC count of block B30 is 10. Inthis case, the controller 4 checks the total amount of valid data ofblock groups included in a GC count management list having a GC count of10. For example, if only block B30 is included in the GC countmanagement list having the GC count of 10, or if two or three blocks areincluded in the GC count management list having the GC count of 10 butthe valid data amounts of these blocks are very small, the controller 4selects a block group to be subjected to a GC operation, along with theblocks having the GC count of 10.

At this time, the controllers 4 may select a block group having amaximum GC count among all block groups having GC counts less by atleast one than the GC count of block B30 having the maximum invalid dataamount (in the embodiment, a block group having a GC count of 9, a blockgroup having a GC count of 8, a block group having a GC count of 7, . .. , a block group having a GC count of 0).

The controller 4 first refers to a GC count management list having a GCcount of 9, thereby determining whether there is a block having the GCcount of 9. If there is no block having the GC count of 9, thecontroller 4 refers to a GC count management list having a GC count of8, thereby determining whether there is a block having the GC count of8.

If there is no block having the GC count of 9 but there are blockshaving the GC count of 8, the controller 4 selects the blocks having theGC count of 8 (for example, blocks B41, B42 and B43). Subsequently, thecontroller 4 copies the valid data of block B30 and the valid data ofthe blocks having the GC count of 8 to the copy destination free block.In this case, it is not always necessary to use all valid data of blocksB41, B42 and B43, but it is sufficient if the valid data of at least oneof blocks B41, B42 and B43 is used.

The flowchart of FIG. 10 shows the procedure of a GC operation includingprocessing of merging the valid data of two block groups having thedifferent GC counts.

The controller 4 checks the number of remaining free blocks (step S21),thereby determining whether the number of remaining free blocks is lessthan or equal to threshold th1 (step S22). As described above, thischeck may be performed periodically.

If the number of remaining free blocks is less than or equal tothreshold th1 (YES in step S22), the controller 4 selects a first GCcandidate from all active blocks. The first GC candidate may be a blockhaving a maximum amount of invalid data. In this case, the block havingthe maximum amount of invalid data is selected as the first GC candidatefrom all active blocks (step S23). The controller 4 refers to the GCcount management list 34, selects a group of blocks (first block group)associated with the same GC count as that of the first GC candidate (forexample, the block having the maximum amount of invalid data), therebydetermining whether the total amount of the valid data of this group ofblocks (first block group) is less than or equal to threshold th2 (stepS24).

Threshold th2 may be a constant, or a variable that can be changed whenneeded. The greater threshold th2 is, the more easily theabove-described merging processing is executed.

For example, threshold th2 may be beforehand set to a value thatindicates the capacity of one block in the SSD 3. This enables mergeprocessing to be permitted only when a GC operation cannot be performedusing only a group of blocks having the same GC count as that of thefirst GC candidate. Alternatively, threshold th2 may be set to anintegral multiple of the capacity of one block in the SSD 3, forexample, twice the capacity.

If the total amount of the valid data of the first block group isgreater than threshold th2 (NO in step S24), the controller 4 selectssome GC target blocks from the first block group (step S25). In stepS25, these GC target blocks are selected from the first block groupindicated by a GC count list that includes the first GC candidate (forexample, the block having the maximum amount of invalid data). In thiscase, the first GC candidate (for example, the block having the maximumamount of invalid data) and one or more other blocks included in the GCcount list may be selected as GC target blocks.

In step S25, the controller 4 copies all valid data of the selected GCtarget blocks to a copy destination free block. The controller 4 furtherupdates the look-up table (LUT) 33, associates the LBAs of the copiedvalid data with the physical addresses of the copy destination freeblock, and invalidates the original pages of each GC target block.

After that, the controller 4 sets, as the GC count of the copydestination free block, a value obtained by adding one to the GC countof each of the selected GC target blocks, i.e., by adding one to the GCcount of the first block group (step S26).

In contrast, if the total amount of the valid data of the first blockgroup is less than or equal to threshold th2 (YES in step S24), thecontroller 4 selects a group of blocks (second block group) associatedwith a maximum GC count, from all block groups associated with GC countsless by at least one than the GC count of the first block group (stepS27).

The controller 4 copies the valid data of the first and second blockgroups to the copy destination free block (step S28). In step S28, thecontroller 4 further updates the look-up table (LUT) 33, associates theLBAs of the copied valid data with the physical addresses of the copydestination free block, and invalidates the original pages of each GCtarget block.

The controller 4 sets, as the GC count of the copy destination freeblock, a value obtained by adding one to the GC count of the secondblock group or by adding one to the GC count of the first block group(step S29). If the number of GC target blocks in the second block groupis greater than that of GC target blocks in the first block group, thevalue obtained by adding one to the GC count of the second block groupmay be set as the GC count of the copy destination free block.Alternatively, if the number of GC target blocks in the first blockgroup is greater than that of GC target blocks in the second blockgroup, the value obtained by adding one to the GC count of the firstblock group may be set as the GC count of the copy destination freeblock.

FIG. 11 shows an operation of permitting merge processing only on ablock group having a GC count greater than or equal to a predeterminedvalue.

It is strongly possible that valid data contained in a block of a largeGC count will be data (data item A) of a low update frequency. However,since data item A is also rewritten at a rate of 20%, even a block of alarge GC count (for example, a block with the GC count of 10) maycontain a large amount of invalid data. Valid data in a block of a largeGC count is data that has never been updated (written) so far, namely,data maintained in a valid state. Therefore, it is strongly possiblethat this valid data will be little updated from now on.

In contrast, it is strongly possible that a block of a small GC countcontains data item B or C. In such a block, all data therein may beinvalidated over time even if no GC operation is executed on the block.

In view of the above, it is sufficient if merge processing is executedonly on blocks having GC counts greater than or equal to mergepermission threshold th3. This prevents useless data copying and henceenhances the efficiency of GC.

FIG. 11 shows an example case where merge permission threshold th3 isset to a GC count of 8.

In this case, if the GC count of a block group (first block group)associated with the same GC count as the GC count of the first GCcandidate is eight or more, merge processing of the first block groupand another block group will be permitted.

For example, merge processing of a block group with the GC count of 10and another block group, and merge processing of a block group with theGC count of 9 and another block group, are permitted. However, mergeprocessing of, for example, a block group with the GC count of 7 andanother block group is inhibited.

The flowchart of FIG. 12 shows the procedure of a GC operation thatincludes an operation of permitting merge processing only on a blockgroup having a GC count greater than or equal to a predetermined value.

The GC operation illustrated in the flowchart of FIG. 12 includes stepsS30 to S33, in addition to the steps illustrated in FIG. 10. In thedescription below, steps S30 to S33 will be mainly described.

If the total amount of the valid data of the first block group is lessthan or equal to threshold th2 (YES in step S24), processing of thecontroller 4 proceeds to step S30. In step S30, the controller 4determines whether the GC count of the first block group is greater thanor equal to merge permission threshold th3.

If the GC count of the first block group is greater than or equal tomerge permission threshold th3 (YES in step S30), the controller 4performs merge processing of steps S27 to S29 described above referringto FIG. 10.

If the GC count of the first block group is less than merge permissionthreshold th3 (NO in step S30), the controller 4 inhibits mergeprocessing and executes steps S31 to S33, instead.

In step S31, the controller 4 selects, as the GC target block group,another block group which differs from the first block group. Forinstance, the controller 4 may select, as a new GC candidate, a blockthat is large in the amount of invalid data next to the first GCcandidate block, and may select, as the GC target block group, blocksindicated by a GC count list that includes the new GC candidate.

Subsequently, the controller 4 copies the valid data of the selected GCtarget block group to the copy destination free block (step S32), andsets the GC count of the copy destination free block to a value obtainedby adding one to the GC count of the GC target block group (step S33).

If the first GC candidate block is associated with the GC count lessthan merge permission threshold th3, it is strongly possible that thefirst GC candidate block includes data to be frequently updated. Becauseof this, the controller 4 may wait, without performing GC on the firstGC candidate block, until all valid data of the block is invalidated.

Referring then to FIGS. 13 to 22, the function of notifying an LBA-baseupdate frequency will be described in detail.

FIG. 13 shows an operation of sequentially allocating free blocks aswrite target blocks used for writing data received from the host 2.

The controller 4 allocates, as a write target block 62, one of the freeblocks indicated by the free block list 60. At this time, the controller4 updates the block-use-order management list 35 to thereby set, to one,the allocated number (sequential number) of a block first allocated asthe write target block 62. As shown in FIG. 14, the block-use-ordermanagement list 35 holds allocated numbers (sequential numbers)corresponding to respective block addresses. These allocated numbersrepresent the order relationship between blocks allocated to the writetarget block 62. That is, the controller 4 allocates numbers, indicatingthe order of allocation, to the blocks allocated as write target blocks,and manages these allocated numbers, using the block-use-ordermanagement list 35.

The controller 4 writes, to the write buffer 31, write data receivedfrom the host 2. After that, while updating the look-up table (LUT) 33,the controller 4 sequentially writes write data from the leading page ofthe write target block 62 toward the last page of the same.

If the write target block 62 has no more available pages, the controller4 moves the write target block 62 to an active block list 61, and sets,as a new write target block 62, a free block in the free block list 60.At this time, the controller 4 updates the block-use-order managementlist 35 to thereby set, to two, the number (sequential number) allocatedto the block that is allocated as the new write target block 62.

If all data of a block in the active block list 61 is invalidated by itsupdate, this block is moved to the free block list 60.

If the number of free blocks in the free block list 60 decreases lessthan or equal to threshold th1, the above-described GC operation ofcreating a free block is performed.

FIG. 15 shows accumulated-written-data-amount calculation operationexecuted when a write to the same LBA has been requested.

Upon receiving a write command including a certain LBA from the host 2,the controller 4 notifies, in response to the write command, the host 2of accumulated written data amount (i.e., an amount of written dataaccumulated from last write to this LBA). The accumulated written dataamount indicates the total amount of data written by the host 2 to theNAND memory 5 during a time ranging from the last write to the same LBAas the LBA included in the received write command, to the current writeto the same LBA.

The accumulated written data amount can be calculated from, for example,the following values:

(1) Capacity per block

(2) The number of pages in each block

(3) A first physical storage position (old physical address) in the NANDmemory 5, to which data was written in the last write to the same LBA

(4) A second physical storage position (new physical address) in theNAND memory 5, to which data is to be written in the current write tothe same LBA

(5) The number of blocks allocated for writing data from the host 2during the time ranging from allocation of a block including the firstphysical storage position (old physical address) to allocation of ablock including the second physical storage position (new physicaladdress)

The values in items (1) to (4) are common management data in the SSD 3,and are not dedicated to the calculation of the accumulated written dataamount. For example, the controller 4 can easily acquire, as the firstphysical address, a physical address mapped to an LBA included in thereceived write command, by referring to the look-up table (LUT) 33.

The number of blocks in item (5) can be easily calculated from, forexample, a sequential number allocated to a block including the firstphysical position, and a sequential number allocated to a blockincluding the second physical position.

The allocated numbers (sequential numbers) are managed using theblock-use-order management list 35 of FIG. 14. Since a unit ofmanagement for the allocated numbers (sequential numbers) is a block,only a small capacity is required to hold the sequential numbers.Therefore, the accumulated written data amount can be calculated at lowcost, without dedicated management data for the calculation.

FIG. 15 shows an operation of calculating the accumulated written dataamount, executed upon receiving a write command including LBA 10.

Assume here a case where data is already written to page Px of block B51by the last write to LBA 10, and data should be written to page Py ofcurrent write target block B62 by the current write to LBA 10. If theallocated number of block B51 is 10 and the allocated number of blockB62 is 13, it is evident that two write target blocks (for example,blocks B52 and B61) are allocated between blocks B51 and B62.

The accumulated written data amount is given by d1+d2+d2+d3.

In this case, d1 is the number of pages included in block B51 andsubsequent to page Px, or is a capacity corresponding to the number ofthe pages, d2 is the number of pages in one block, or the capacity ofone block, and d3 is the number of pages in block B62 followed by pagePy, or a capacity corresponding to the number of these pages.

The greater the number of write commands received from the host 2 duringthe time from the reception of the last write command including LBA 10to the reception of the current write command including LBA 10, thegreater the accumulated written data amount. Accordingly, theabove-mentioned accumulated written data amount expresses the updatefrequency of data specified by LBA 10, i.e., the frequency of writing toLBA 10.

Upon receiving a write command, the controller 4 may obtain (calculate)the accumulated written data amount in the following procedure:

First, the controller 4 refers to the look-up table (LUT) 33, therebyacquiring an old physical address (in this case, PA1) mapped to the LBA(in this case, LBA 10) included in the write command. Subsequently, thecontroller 4 refers to the block-use-order management list 35, therebyacquiring an allocated block number (in this case, 10) designated by theold physical address, and an allocated block number (in this case, 13)designated by a new physical address (in this case, PA2). The controller4 calculates d1 from the number of pages included in one block and theold physical address (PA1), and calculates d3 from the number of pagesincluded in one block and new physical address (PA2). Furthermore, basedon the difference between the allocated numbers (13) and (10), thecontroller calculates the total number (in this case, 2) of blocksallocated as write target blocks during the time from when the blockdesignated by the old physical address is allocated as the write targetblock, to when the block designated by the new physical address isallocated as the write target block. Thus, the accumulated written dataamount (=d1+d2+d2+d3) can be obtained (calculated).

FIG. 16 shows a sequence of accumulated-written-data-amount responseprocessing.

Assume here a case where this processing sequence is applied to a NativeCommand Queuing (NCQ) system wherein a write command and write data aredivided.

The host 2 sends, to the SSD 3, a write command including a starting LBAthat indicates a certain LBA (=LBAx). In response to the received writecommand, the controller 4 of the SSD 3 calculates an accumulated writtendata amount, i.e., a written data amount accumulated during the timefrom the last write to LBAx to the current write to LBAx (step S41), andtransmits, to the host 2, a command permission response including dataon the calculated accumulated written data amount. The commandpermission response is a permission response indicating acknowledgement(permission of execution of the write command) to the received writecommand. When the SSD 3 has transmitted the permission response to thehost 2, transfer of write data designated by the write command isstarted. The permission response may include a value that identifies awrite command whose execution is permitted. The accumulated written dataamount may be expressed, for example, in bytes or by the number oflogical blocks (logical sectors).

In response to the command permission response, the host 2 sends writedata to the SSD 3. The controller 4 of the SSD 3 writes the write datato the write buffer 31, writes the write data of the write buffer 31 toa current write target block (step S42), and transmits, to the host 2, aresponse indicating the completion of the command. When the write datahas been written to the write buffer 31, the response indicating thecompletion of the command may be transmitted to the host 2.

The host 2 can grasp an actual update frequency (the frequency ofwriting to LBAx) of data corresponding to LBAx, based on data indicatingthe accumulated written data amount and included in the commandpermission response received from the SSD 3.

If the actual update frequency of data corresponding to LBAx differsfrom the update frequency of the data predicted by the host 2, forexample, if the actual update frequency of the data is greater than thepredicted update frequency, the host 2 may send an abort command foraborting the sent write command, when necessary. In this case, writingof the data designated by the write command is not executed.

The flowchart of FIG. 17 shows the procedure ofaccumulated-written-data-amount response processing executed by thecontroller 4.

The controller 4 receives, from the host 2, a write command includingLBAx as a starting LBA (step S51). The controller 4 calculates anaccumulated written data amount obtained during the time from the lastwrite to LBAx to the current write to LBAx, based on an old physicaladdress mapped to LBAx, a new physical address to be mapped to LBAx, anallocated number allocated to a block including a physical storageposition designated by the old physical address, an allocated numberallocated to a block (current write target block) including a physicalstorage position designated by the new physical address, etc (step S52).The controller 4 returns, to the host 2, a permission response includingthe accumulated written data amount (step S53).

The controller 4 determines whether write data corresponding to thewrite command or an abort command for aborting the write command hasbeen received from the host 2 (step S54).

If the write data has been received, the controller 4 proceeds to stepS55. In step S55, the controller 4 writes the write data to the writebuffer 31, writes the write data in the write buffer 31 to the currentwrite target block, updates the look-up table (LUT) 33 to map the newphysical address to LBAx, and updates the page management table toinvalidate the old physical address (old data).

After that, the controller 4 returns, to the host 2, a responseindicating the completion of the command (step S56).

As described above, the response indicating the completion of thecommand may be transmitted to the host 2 when the write data has beenwritten to the write buffer 31.

In contrast, if the abort command has been received, the controller 4aborts the write command (step S57).

FIG. 18 shows another sequence of the accumulated-written-data-amountresponse processing.

The host 2 sends, to the SSD 3, a write command including a certain LBA(=LBAx) as a starting LBA. In response to this write command, thecontroller 4 of the SSD 3 transmits a command permission response to thehost 2. In response to the command permission response, the host 2 sendswrite data to the SSD 3. The write data is written to the write buffer31. The controller 4 of the SSD 3 calculates an accumulated written dataamount (step S58). The processing of calculating the accumulated writtendata amount may be started upon receiving the write command.

Thereafter, the controller 4 writes the write data to the write targetblock (step S59), and transmits, to the host 2, a response indicatingthe command completion and including the calculated accumulated dataamount.

In addition, as described above, the command completion responseincluding the calculated accumulated data amount may be transmitted tothe host 2 when the write data has been written to the write buffer 31.

The flowchart of FIG. 19 shows yet another procedure of theaccumulated-written-data-amount response processing.

The controller 4 receives a write command including LBAx as a startingLBA from the host 2 (step S61). The controller 4 returns a permissionresponse to the host 2 (step S62). The controller 4 receives write datafrom the host 2 (step S63). The write data is written to the writebuffer 31.

The controller 4 calculates an accumulated written data amount obtainedduring the time from the last write to LBAx to the current write toLBAx, based on an old physical address mapped to LBAx, a new physicaladdress to be mapped to LBAx, an allocated number allocated to a blockincluding a physical storage position designated by the old physicaladdress, an allocated number allocated to a block (current write targetblock) including a physical storage position designated by the newphysical address, etc (step S64). The controller 4 proceeds to step S65.

In step S65, the controller 4 writes the write data in the write buffer31 to the current write target block, updates the look-up table (LUT) 33to map the new physical address to LBAx, and updates the page managementtable to invalidate the old physical address (old data).

After that, the controller 4 returns, to the host 2, a commandcompletion response including the accumulated written data amount (stepS66).

As described above, the command completion response may be transmittedto the host 2 when the write data has been written to the write buffer31.

Referring then to FIGS. 20 to 23, a description will be given ofprocessing of notifying the host 2 of time data associated with the timethat has elapsed from the last write to the same LBA, instead of theaccumulated written data amount.

The time data is associated with the time that has elapsed from the lastwrite to the same LBA, and may indicate the time when the last write tothe same LBA was made, or may indicate the time interval between thelast and current writes to the same LBA.

FIG. 20 shows an example of the look-up table (LUT) 33 configured tomanage, in units of, for example, 4 Kbytes (=a predetermined managementunit), the correspondence relationship between the LBA, the physicaladdress, and the time when the last write was made.

The look-up table (LUT) 33 includes physical address storage areas 33Aand time storage areas 33B for respective LBAs. Each time storage area33B is used to hold a value indicating the time when a write was made toa corresponding LBA, namely, a value indicating the time when the dataof the corresponding LBA was written. The time held in each time storagearea 33B may be an hour/minute/second, for example.

Upon receiving a write command including a certain LBA, the controller 4registers a corresponding physical address in a physical address storagearea 33A corresponding to the LBA, and registers, in a time storage area33B corresponding to the LBA, the time when data (write data) designatedby the write command has been written. The physical address is thephysical address of a physical storage position to which the datadesignated by the write command has been written. The time when a writehas been made may be the time when the write command has been received,may be the time when the data designated by the write command has beenwritten to the write buffer 31, or may be the time when the datadesignated by the write command has been written to a write target blockin the NAND memory 5.

The flowchart of FIG. 21 shows the procedure of time-data responseprocessing performed by the controller 4.

Assume here a case where a command permission response including timedata is transmitted to the host 2.

The controller 4 receives a write command including LBAx as a startingLBA from the host 2 (step S71). The controller 4 refers to the look-uptable (LUT) 33, thereby acquiring the time when the last write to LBAxwas made, namely, the time when data was written in response to the lastwrite command including LBAx (step S72). The controller 4 returns acommand permission response including the time data to the host 2 (stepS73). As described above, the time data may be a time interval betweenthe last and current writes to LBAx, namely, a time obtained bysubtracting the time of the last write to LBAx from the current time(the time of the current write to LBAx).

The controller 4 determines whether write data corresponding to thewrite command or an abort command for aborting this write data has beenreceived from the host 2 (step S74).

If the write data has been received, the controller 4 proceeds to stepS75. In step S75, the controller 4 writes the write data to the writebuffer 31, writes the write data in the write buffer 31 to the currentwrite target block, updates the look-up table (LUT) 33 to map a newphysical address and a new write time to LBAx, and updates the pagemanagement table to invalidate an old physical address (old data).

Thereafter, the controller 4 returns a command completion response tothe host 2 (step S76).

As described above, the command completion response may be transmittedto the host 2 when the write data has been written to the write buffer31.

In contrast, if the abort command has been received, the controller 4aborts the write command (step S77).

Although the flowchart of FIG. 21 is directed to the case oftransmitting the command permission response including time data istransmitted to the host 2, a command completion response including timedata may be transmitted to the host 2. The transmission of the commandcompletion response including time data can be realized by the sameprocedure as that shown in FIGS. 18 and 19.

The flowchart of FIG. 22 shows the procedure of processing performed bythe host 2 based on the accumulated written data amount/time datanotified by the SSD 3.

The host 2 may classify data into two or more types of data groupshaving different update frequencies, based on the accumulated writtendata amount/time data notified by the SSD 3. For instance, the filesystem 43 of the host 2 may include a data manager configured toclassify data into two or more types of data groups, thereby separatinga data group (hot data group) wherein data is frequently updated, from adata group (cold data group) wherein data is not frequently updated. Ifthe frequency of update of data written to the SSD 3 is greater than orequal to a certain threshold, the data manager can recognize that thisdata is hot data.

The data manager may move data, detected to be hot data, from the SSD 3to another storage device, in order to cause the update frequencies ofrespective LBA ranges in the same SSD to fall within as the samefrequency range as possible.

On the other hand, if the SSD 3 is realized as an expensive SSD havinghigh endurance, hot data may be left in the SSD 3, and cold data may bemoved from the SSD 3 to another storage device. An example of theexpensive SSD having high endurance includes an SLC-SSD that holdsone-bit data per memory cell.

One of the indices that indicate the endurance of an SSD is a drivewrite per day (DWPD). For example, regarding an SSD having a totalcapacity of 1 terabytes (1 TB), DWPD=10 means that a data write of 10terabytes (10 TB) (=10×1 TB) can be performed per day over five years.

A procedure example of the above processing will now be described.

The host 2 transmits a write command including LBAx to the SSD 3 (stepS81), and receives from the SSD 3 a response (a command permissionresponse or a command completion response) including (1) data indicativeof the accumulated written data amount or (2) time data (step S82).

Based on the accumulated written data amount or time data, the host 2determines whether the update frequency of the data of LBAx (thefrequency of writes to LBAx) is greater than or equal to a predeterminedupper limit (threshold th4) (step S83). For example, in the case wherethe accumulated written data amount is notified by the SSD 3, the host 2may determine whether the accumulated written data amount is greaterthan or equal to a threshold data amount corresponding to threshold th4.In the case where time data (indicating the time of the last write tothe same LBA) is notified by the SSD 3, the host 2 may calculate a timeinterval by subtracting the time of the last write from the currenttime, and may determine whether this interval is greater than or equalto a threshold interval corresponding to threshold th4. Alternatively,the host 2 may convert the accumulated written data amount or the timedata into a percentage that indicates the ratio of write access to LBAxto all write accesses to all LBAs, thereby determining whether thepercentage is greater than or equal to a threshold percentage representby threshold th4.

If the update frequency (the frequency of writes to LBAx) of the data ofLBAx is greater than or equal to threshold th4 (YES in step S83), thehost 2 classifies the data of LBAx as a high-update-frequency data group(hot data) (step S84), and moves the data of LBAx from the SSD 3 toanother storage device (step S85).

In step S84, if the response including the accumulated written dataamount or the time data is a permission response to the write command,the host 2 may perform processing of aborting the write command.

FIG. 23 shows a hardware configuration example of the informationprocessing apparatus serving as the host 2.

The information processing apparatus is realized as a server computer ora personal computer. The information processing apparatus comprises aprocessor (CPU) 101, a main memory 102, a BIOS-ROM 103, a networkcontroller 105, a peripheral interface controller 106, a controller 107,an embedded controller (EC) 108, etc.

The processor 101 is a CPU configured to control the operation of eachcomponent of the information processing apparatus. This processor 101executes various programs loaded from any one of the SSDs 3 to the mainmemory 102. The main memory 102 comprises a random access memory such asa DRAM. The programs executed by the processor 101 include theabove-described application software layer 41, the operating system 42and the file system 43.

The processor 101 also executes the basic input/output system (BIOS)stored in the BIOS-ROM 103 as a nonvolatile memory. The BIOS is a systemprogram for hardware control.

The network controller 105 is a communication device, such as a wiredLAN controller or a wireless LAN controller. The peripheral interfacecontroller 106 is configured to communicate with a peripheral device,such as a USB device.

The controller 107 is connected to a plurality of connectors 107A, andis configured to communicate with devices connected to the connectors107A. In the embodiment, a plurality of SSDs 3 are connected to therespective connectors 107A. The controller 107 is an SAS expander, aPCIe Switch, a PCIe expander, a flash array controller, or a RAIDcontroller.

The EC 108 functions as a system controller configured to perform powermanagement of the information processing apparatus. The EC 108 turns onand off the information processing apparatus in response to a user'soperation of a power switch. The EC 108 is realized as processingcircuitry such as a one-chip microcontroller. The EC 108 may contain akeyboard controller for controlling an input device such as a keyboard(KB).

The processing described referring to FIG. 22 is performed by theprocessor 101 under control of the file system 43.

FIG. 24 shows a configuration example of the information processingapparatus including a plurality of SSDs 3 and the host 2.

The information processing apparatus comprises a thin box-shaped casing201 that can be accommodated in a rack. The SSDs 3 may be arranged inthe casing 201. In this case, the SSDs 3 may be detachably inserted inrespective slots formed in the front surface 201A of the casing 201.

A system board (mother board) 202 is placed in the casing 201. On thesystem board (mother board) 202, various electronic components, whichinclude the CPU 101, the memory 102, the network controller 105 and thecontroller 107, are mounted. These electronic components cooperate tofunction as the host 2.

As described above, in the GC function considering the GC count of datain a block, according to the embodiment, the GC count indicating thetimes of copying of data in each block (which includes data written bythe host 2) made by garbage collection (GC) operations is managed blockby block, and a plurality of blocks (first blocks) associated with thesame GC count are selected as garbage collection (GC) target blocks.After that, the valid data in the first blocks is copied to a copydestination free block, and a value obtained by adding one to the GCcount of the first blocks is set as the GC count of the copy destinationfree block. This prevents data of high update frequency and data of lowupdate frequency from being copied by GC operations to the same block.As a result, the greater the GC count, the greater the ratio oflow-update-frequency data to the capacity of a block. Therefore, thelow-update-frequency data can be separated from thehigh-update-frequency data. This means that increases in the number ofblocks where various types of data having different update frequenciesare merged can be suppressed. That is, even if data written to the SSD 3has high data locality, increases in the number of blocks where varioustypes of data having different update frequencies are merged can besuppressed, thereby suppressing increases in the write amplification ofthe SSD 3.

In addition, the embodiment employs a NAND memory as an example of thenonvolatile memory. However, the function of the embodiment is alsoapplicable to other various nonvolatile memories, such as amagnetoresistive random access memory (MRAM), a phase-change randomaccess memory (PRAM), a resistive random access memory (ReRAM), and aferroelectric random access memory (FeRAM).

While certain embodiments have been described, these embodiments havebeen presented by way of example only, and are not intended to limit thescope of the inventions. Indeed, the novel embodiments described hereinmay be embodied in a variety of other forms; furthermore, variousomissions, substitutions and changes in the form of the embodimentsdescribed herein may be made without departing from the spirit of theinventions. The accompanying claims and their equivalents are intendedto cover such forms or modifications as would fall within the scope andspirit of the inventions.

What is claimed is:
 1. A memory system comprising: a nonvolatile memoryincluding a plurality of blocks; and a controller electrically connectedto the nonvolatile memory and configured to perform a garbage collectionoperation of the nonvolatile memory, wherein the controller isconfigured to: select a first block and a second block as garbagecollection target blocks, the first block and the second block having afirst garbage collection count, the first garbage collection countindicating a number of times that data in each of the first block andthe second block have been copied by past one or more garbage collectionoperations, copy valid data in the first block and valid data in thesecond block to a third block that is a free block, select a fourthblock and a fifth block as garbage collection target blocks, the fourthblock and the fifth block having a second garbage collection count, thesecond garbage collection count indicating a number of times that datain each of the fourth block and the fifth block have been copied by pastone or more garbage collection operations, copy valid data in the fourthblock and valid data in the fifth block to a sixth block that is a freeblock, in a case where the first garbage collection count is equal tothe second garbage collection count, select the third block and thesixth block as garbage collection target blocks, the third block and thesixth block having a same third garbage collection count, and copy validdata in the third block and valid data in the sixth block to a seventhblock that is a free block, and wherein the garbage collection count ofthe third block becomes a value obtained by adding one to the firstgarbage collection count, or the garbage collection count of the sixthblock becomes a value obtained by adding one to the second garbagecollection count.
 2. The memory system of claim 1, wherein thecontroller is configured to perform the garbage collection operationwhen a number of remaining free blocks of the nonvolatile memory is lessthan or equal to a threshold.
 3. The memory system of claim 1, whereinthe same third garbage collection count of the third block and the sixthblock are determined from the first garbage collection count and thesecond garbage collection count, respectively.
 4. A method ofcontrolling a nonvolatile memory including a plurality of blocks, andperforming a garbage collection operation of the nonvolatile memory, themethod comprising: selecting a first block and a second block as garbagecollection target blocks, the first block and the second block having afirst garbage collection count, the first garbage collection countindicating a number of times that data in each of the first block andthe second block have been copied by past one or more garbage collectionoperations; copying valid data in the first block and valid data in thesecond block to a third block that is a free block; selecting a fourthblock and a fifth block as garbage collection target blocks, the fourthblock and the fifth block having a second garbage collection count, thesecond garbage collection count indicating a number of times that datain each of the fourth block and the fifth block have been copied by pastone or more garbage collection operations; copying valid data in thefourth block and valid data in the fifth block to a sixth block that isa free block; in a case where the first garbage collection count isequal to the second garbage collection count, selecting the third blockand the sixth block as garbage collection target blocks, the third blockand the sixth block having a same third garbage collection count; andcopying valid data in the third block and valid data in the sixth blockto a seventh block that is a free block, wherein the garbage collectioncount of the third block becomes a value obtained by adding one to thefirst garbage collection count, or the garbage collection count of thesixth block becomes a value obtained by adding one to the second garbagecollection count.
 5. The method of claim 4, further comprising:performing the garbage collection operation when a number of remainingfree blocks of the nonvolatile memory is less than or equal to athreshold.
 6. The method of claim 4, wherein the same third garbagecollection count of the third block and the sixth block are determinedfrom the first garbage collection count and the second garbagecollection count, respectively.